package com.starbaba.util;

import java.util.ArrayList;

import org.apache.http.message.BasicNameValuePair;

import com.starbaba.common.HttpConnection;


public class PushService {
	private final static String ADDRESS = "http://xmiles.cn/back_platform_message_service/";
//	 private final static String ADDRESS = "http://127.0.0.1:8080/back_platform_message_service/";
//	 private final static String ADDRESS = "http://112.74.79.60:14000/back_platform_message_service/";
	
	
	public static void pushMessage(String btype,String title,String content , String userId , String show_type , String notify_type , String response_type)
	{
		String servlet = "orderpush";
		ArrayList<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
		list.add(new BasicNameValuePair("btype", btype));
		list.add(new BasicNameValuePair("title", title));
		list.add(new BasicNameValuePair("content", content));
		list.add(new BasicNameValuePair("userId", userId));
		list.add(new BasicNameValuePair("show_type", show_type));
		list.add(new BasicNameValuePair("notify_type", notify_type));
		list.add(new BasicNameValuePair("response_type", response_type));
		HttpConnection.connection(ADDRESS + servlet, HttpConnection.POST, list);
	}
	
	public static void pushMallMessage( String userId , String  title , String content)
	{
		String servlet = "mallpush";
		ArrayList<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
		list.add(new BasicNameValuePair("userid", userId));
		list.add(new BasicNameValuePair("title", title));
		list.add(new BasicNameValuePair("content", content));
		HttpConnection.connection(ADDRESS + servlet, HttpConnection.POST, list);
	}
	
	
	public static void pushGroupMessage(String title ,  String url , String iospushurl , String content , String province , String platfrom)
	{
		String servlet = "grouppush";
		ArrayList<BasicNameValuePair> list = new ArrayList<BasicNameValuePair>();
		list.add(new BasicNameValuePair("title", title));
		list.add(new BasicNameValuePair("htmlurl", url));
		list.add(new BasicNameValuePair("content", content));
		
		
		list.add(new BasicNameValuePair("iospushurl", iospushurl));
		list.add(new BasicNameValuePair("platfrom", platfrom));
		list.add(new BasicNameValuePair("province", province));
		HttpConnection.connection(ADDRESS + servlet, HttpConnection.POST, list);
		
	}
	
	public static void main(String[] args) {
		pushMallMessage(String.valueOf(62906L), "测试", "内容");
		// pushMessage(String.valueOf(14), "违章处理", "违章处理已成功", String.valueOf(62906), "1", "1", "1");
	}
}
